<?php 
	include_once '../../LMSController/LMSStudentRequestController/LMSStudentRequestController.php';
    session_start();
?>
<html>
	<head>
		<title>
			Student Home Page
		</title>
        <script>
		
		 function applyBook(bookID)
		 {
			window.location.href = "../../LMSController/LMSStudentRequestController/LMSBookRequestController.php?BookID="+bookID;
		 }
		</script>
	</head>
	<body>
    	<center>
        	<h2>Student Home page</h2>
			<?php
				//retrieve session data
				echo "<p align=\"left\">Loggedin As : ".$_SESSION['ID']."</p>";
			?>
        </center>
     	<hr/>
		<h3> Menus </h3>
        <hr/>
            <?php
					$object = new RequestController();
					$data = $object->getBooksData();
					echo "<table border=\"1\" cellpadding=\"5\" >";
					echo "<tr><th>Book Name</th><th>Edition Number</th><th>Author Name</th><th>publication</th></tr>";
					while($row = mysql_fetch_array($data))
						{
							$bookID = $row['bookID'];
							echo "<tr>";
							echo "<td>".$row['bookName']."</td>";
							echo "<td>".$row['editionNumber']."</td>";
							echo "<td>".$row['authorName']."</td>";
							echo "<td>".$row['publication']."</td>";
							echo "<td><input type=\"submit\" id=\"button\" onClick=\"applyBook($bookID)\" value=\"Apply\" /></td>";
							echo "<td></td>";
							echo "</tr>";
						}
					echo "</table>";
			?>
	</body>
</html>